<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
	<title>Sensor Information</title>
</head>
<body>
	<h1>Sensor Information</h1>
	<p>This is the sensor information page.</p>

	<div>
		<h2>Sensor Mac Address: {{sensor_mac}}</h2>
		<h2>开始时间: {{start_time}}</h2>
		<h2>结束时间: {{end_time}}</h2>
		<h2>提交次数: {{sensor_data|length}}</h2> 

		<p>默认显示最近4小时的数据</p>
	</div>

	<dev id="time_filter">
		<form action="/sensor_data/{{sensor_mac}}" method="get">
			<label for="start_time">开始时间:</label>
			<input type="datetime-local" id="start_time" name="start_time" required><br><br>
			
			<label for="end_time">结束时间:</label>
			<input type="datetime-local" id="end_time" name="end_time" required><br><br>
			
			<input type="submit" value="提交">
		</form>
	</dev>

	<div>

		<h2>Sensor Data:</h2>
		<!-- sensor_data output example: [(213588, '010b', '倾角', 'e51c038800010b00246303071400000000000c000463000101004ace', '2024-08-10 07:10:53', None), (213701, '010b', '倾角', 'e51c038900010b00246303071400000000000c000463000101008752', '2024-08-10 07:13:04', None)] -->

		<table border="1">
			<tr>
				<th>提交时间</th>
				<th>设备类型</th>
				<th>原始数据</th>

			</tr>
			{% for data in sensor_data %}
			<tr>
				<td>{{data[4]}}</td>
				<td>{{data[2]}}</td>
				<td>{{data[3]}}</td>
			</tr>
			{% endfor %}
		</table>
	</div>

	{{sensor_data}}
</body>
</html>